package com.hzzh.servlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hzzh.service.MeetingRoomService;
import com.hzzh.vo.MeetingRoom;

/**
 * Servlet implementation class UpdateMeetingRoomServlet
 */
@WebServlet("/UpdateMeetingRoomServlet")
public class UpdateMeetingRoomServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateMeetingRoomServlet() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		int roomid=Integer.parseInt(request.getParameter("roomid"));
		int roomnum=Integer.parseInt(request.getParameter("roomnum"));
		int capacity=Integer.parseInt(request.getParameter("capacity"));
		String roomname = request.getParameter("roomname");
		String status = request.getParameter("status");
		String description = request.getParameter("description");
		MeetingRoom meetingroom = new MeetingRoom();
		meetingroom.setRoomid(roomid);
		meetingroom.setRoomnum(roomnum);
		meetingroom.setRoomname(roomname);
		meetingroom.setCapacity(capacity);
		meetingroom.setStatus(status);
		meetingroom.setDescription(description);
		MeetingRoomService service = new MeetingRoomService();
		
		/*service.updateMeetingroom(new MeetingRoom(roomid,roomnum,capacity,roomname,status,description));*/
		/*service.updateMeetingroom(new MeetingRoom());*/
		service.updateMeetingroom(meetingroom);
		request.getRequestDispatcher("ViewAllMeetingRoomsServlet").forward(request, response);
		
	}

}
